package com.ucode.application.form.acis;

import java.io.Serializable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.ucode.acis.mode.Works;
import com.ucode.springboot.starter.web.validator.group.AddGroup;
import com.ucode.springboot.starter.web.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value="作品")
@SuppressWarnings("serial")
public class WorksForm implements Serializable{
  
    @ApiModelProperty(value = "名称",required=true)
    @NotBlank(message = "名称不能为空", groups = {AddGroup.class,UpdateGroup.class})
    @Length(max=50,message = "名称最大50个字符", groups = {AddGroup.class,UpdateGroup.class})
    private String name;
   
    @ApiModelProperty(value = "所处年代",required=false)
    private Integer era;
    
    @ApiModelProperty(value = "文学体裁",required=true)
    @NotNull(message="文学体裁不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private Integer genreType;
    
    @ApiModelProperty(value = "书体类型",required=true)
    @NotNull(message="书体类型不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private Integer bookStyle;

    @ApiModelProperty(value = "所属名家Id",required=true)
    @NotNull(message="所属名家不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private Long famousId;

    @ApiModelProperty(value = "封面图片Id",required=true)
    @NotNull(message="封面图片不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private Long coverId;
 
    @ApiModelProperty(value = "摘要",required=false)
    @Length(max=300,message = "摘要最大300个字符", groups = {AddGroup.class,UpdateGroup.class})
    private String summary;

    @ApiModelProperty(value = "作品简介",required=false)
    private String intro;
   
    @ApiModelProperty(value = "排序号",required=false)
    private Integer sort;
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getEra() {
        return era;
    }

    public void setEra(Integer era) {
        this.era = era;
    }

    public Integer getGenreType() {
        return genreType;
    }

    public void setGenreType(Integer genreType) {
        this.genreType = genreType;
    }

    public Integer getBookStyle() {
        return bookStyle;
    }

    public void setBookStyle(Integer bookStyle) {
        this.bookStyle = bookStyle;
    }

    public Long getFamousId() {
        return famousId;
    }

    public void setFamousId(Long famousId) {
        this.famousId = famousId;
    }

    public Long getCoverId() {
        return coverId;
    }

    public void setCoverId(Long coverId) {
        this.coverId = coverId;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }
    
    public Works build(){
        Works works = new Works();
        works.setName(this.name);
        works.setEra(era);
        works.setGenreType(genreType);
        works.setBookStyle(bookStyle);
        works.setFamousId(famousId);
        works.setCoverId(coverId);
        works.setSummary(summary);
        works.setIntro(intro);
        works.setSort(sort);
        return works;
    }

}
